var NTAR_Areas = new Array(133);
NTAR_Areas[0] = "None";
NTAR_Areas[1] = "Rogue Encampment";
NTAR_Areas[2] = "Blood Moor";
NTAR_Areas[3] = "Cold Plains";
NTAR_Areas[4] = "Stony Field";
NTAR_Areas[5] = "Dark Wood";
NTAR_Areas[6] = "Black Marsh";
NTAR_Areas[7] = "Tamoe Highland";
NTAR_Areas[8] = "Den Of Evil";
NTAR_Areas[9] = "Cave Level 1";
NTAR_Areas[10] = "Underground Passage Level 1";
NTAR_Areas[11] = "Hole Level 1";
NTAR_Areas[12] = "Pit Level 1";
NTAR_Areas[13] = "Cave Level 2";
NTAR_Areas[14] = "Underground Passage Level 2";
NTAR_Areas[15] = "Hole Level 2";
NTAR_Areas[16] = "Pit Level 2";
NTAR_Areas[17] = "Burial Grounds";
NTAR_Areas[18] = "Crypt";
NTAR_Areas[19] = "Mausoleum";
NTAR_Areas[20] = "Forgotten Tower";
NTAR_Areas[21] = "Tower Cellar Level 1";
NTAR_Areas[22] = "Tower Cellar Level 2";
NTAR_Areas[23] = "Tower Cellar Level 3";
NTAR_Areas[24] = "Tower Cellar Level 4";
NTAR_Areas[25] = "Tower Cellar Level 5";
NTAR_Areas[26] = "Monastery Gate";
NTAR_Areas[27] = "Outer Cloister";
NTAR_Areas[28] = "Barracks";
NTAR_Areas[29] = "Jail Level 1";
NTAR_Areas[30] = "Jail Level 2";
NTAR_Areas[31] = "Jail Level 3";
NTAR_Areas[32] = "Inner Cloister";
NTAR_Areas[33] = "Cathedral";
NTAR_Areas[34] = "Catacombs Level 1";
NTAR_Areas[35] = "Catacombs Level 2";
NTAR_Areas[36] = "Catacombs Level 3";
NTAR_Areas[37] = "Catacombs Level 4";
NTAR_Areas[38] = "Tristram";
NTAR_Areas[39] = "Moo Moo Farm";
NTAR_Areas[40] = "Lut Gholein";
NTAR_Areas[41] = "Rocky Waste";
NTAR_Areas[42] = "Dry Hills";
NTAR_Areas[43] = "Far Oasis";
NTAR_Areas[44] = "Lost City";
NTAR_Areas[45] = "Valley Of Snakes";
NTAR_Areas[46] = "Canyon Of The Magi";
NTAR_Areas[47] = "A2 Sewers Level 1";
NTAR_Areas[48] = "A2 Sewers Level 2";
NTAR_Areas[49] = "A2 Sewers Level 3";
NTAR_Areas[50] = "Harem Level 1";
NTAR_Areas[51] = "Harem Level 2";
NTAR_Areas[52] = "Palace Cellar Level 1";
NTAR_Areas[53] = "Palace Cellar Level 2";
NTAR_Areas[54] = "Palace Cellar Level 3";
NTAR_Areas[55] = "Stony Tomb Level 1";
NTAR_Areas[56] = "Halls Of The Dead Level 1";
NTAR_Areas[57] = "Halls Of The Dead Level 2";
NTAR_Areas[58] = "Claw Viper Temple Level 1";
NTAR_Areas[59] = "Stony Tomb Level 2";
NTAR_Areas[60] = "Halls Of The Dead Level 3";
NTAR_Areas[61] = "Claw Viper Temple Level 2";
NTAR_Areas[62] = "Maggot Lair Level 1";
NTAR_Areas[63] = "Maggot Lair Level 2";
NTAR_Areas[64] = "Maggot Lair Level 3";
NTAR_Areas[65] = "Ancient Tunnels";
NTAR_Areas[66] = "Tal Rashas Tomb #1";
NTAR_Areas[67] = "Tal Rashas Tomb #2";
NTAR_Areas[68] = "Tal Rashas Tomb #3";
NTAR_Areas[69] = "Tal Rashas Tomb #4";
NTAR_Areas[70] = "Tal Rashas Tomb #5";
NTAR_Areas[71] = "Tal Rashas Tomb #6";
NTAR_Areas[72] = "Tal Rashas Tomb #7";
NTAR_Areas[73] = "Duriels Lair";
NTAR_Areas[74] = "Arcane Sanctuary";
NTAR_Areas[75] = "Kurast Docktown";
NTAR_Areas[76] = "Spider Forest";
NTAR_Areas[77] = "Great Marsh";
NTAR_Areas[78] = "Flayer Jungle";
NTAR_Areas[79] = "Lower Kurast";
NTAR_Areas[80] = "Kurast Bazaar";
NTAR_Areas[81] = "Upper Kurast";
NTAR_Areas[82] = "Kurast Causeway";
NTAR_Areas[83] = "Travincal";
NTAR_Areas[84] = "Spider Cave";
NTAR_Areas[85] = "Spider Cavern";
NTAR_Areas[86] = "Swampy Pit Level 1";
NTAR_Areas[87] = "Swampy Pit Level 2";
NTAR_Areas[88] = "Flayer Dungeon Level 1";
NTAR_Areas[89] = "Flayer Dungeon Level 2";
NTAR_Areas[90] = "Swampy Pit Level 3";
NTAR_Areas[91] = "Flayer Dungeon Level 3";
NTAR_Areas[92] = "A3 Sewers Level 1";
NTAR_Areas[93] = "A3 Sewers Level 2";
NTAR_Areas[94] = "Ruined Temple";
NTAR_Areas[95] = "Disused Fane";
NTAR_Areas[96] = "Forgotten Reliquary";
NTAR_Areas[97] = "Forgotten Temple";
NTAR_Areas[98] = "Ruined Fane";
NTAR_Areas[99] = "Disused Reliquary";
NTAR_Areas[100] = "Durance Of Hate Level 1";
NTAR_Areas[101] = "Durance Of Hate Level 2";
NTAR_Areas[102] = "Durance Of Hate Level 3";
NTAR_Areas[103] = "The Pandemonium Fortress";
NTAR_Areas[104] = "Outer Steppes";
NTAR_Areas[105] = "Plains Of Despair";
NTAR_Areas[106] = "City Of The Damned";
NTAR_Areas[107] = "River Of Flame";
NTAR_Areas[108] = "Chaos Sanctuary";
NTAR_Areas[109] = "Harrogath";
NTAR_Areas[110] = "Bloody Foothills";
NTAR_Areas[111] = "Frigid Highlands";
NTAR_Areas[112] = "Arreat Plateau";
NTAR_Areas[113] = "Crystalized Passage";
NTAR_Areas[114] = "Frozen River";
NTAR_Areas[115] = "Glacial Trail";
NTAR_Areas[116] = "Drifter Cavern";
NTAR_Areas[117] = "Frozen Tundra";
NTAR_Areas[118] = "Ancient's Way";
NTAR_Areas[119] = "Icy Cellar";
NTAR_Areas[120] = "Arreat Summit";
NTAR_Areas[121] = "Nihlathaks Temple";
NTAR_Areas[122] = "Halls Of Anguish";
NTAR_Areas[123] = "Halls Of Pain";
NTAR_Areas[124] = "Halls Of Vaught";
NTAR_Areas[125] = "Abaddon";
NTAR_Areas[126] = "Pit Of Acheron";
NTAR_Areas[127] = "Infernal Pit";
NTAR_Areas[128] = "The Worldstone Keep Level 1";
NTAR_Areas[129] = "The Worldstone Keep Level 2";
NTAR_Areas[130] = "The Worldstone Keep Level 3";
NTAR_Areas[131] = "Throne Of Destruction";
NTAR_Areas[132] = "The Worldstone Chamber";

NTAR_Areas[133] = "Matron's Den";
NTAR_Areas[134] = "Fogotten Sands";
NTAR_Areas[135] = "The Worldstone Chamber";
NTAR_Areas[136] = "The Worldstone Chamber";

function NTAR_GetAreaName(areaid)
{
	if(areaid < 0 || areaid > 132)
		return "Unknown";

	return NTAR_Areas[areaid];
}

function NTAR_GetAreaID(areaname)
{
	for(var i = 0 ; i < 133 ; i++)
	{
		if(areaname.toLowerCase() == NTAR_Areas[i].toLowerCase())
			return i;
	}

	return -1;
}
var NTAR_PreviousAreas = new Array(133);
NTAR_PreviousAreas[0]=0;
NTAR_PreviousAreas[1]=1;
NTAR_PreviousAreas[2]=1;
NTAR_PreviousAreas[3]=2;
NTAR_PreviousAreas[4]=3;
NTAR_PreviousAreas[5]=10;
NTAR_PreviousAreas[6]=5;
NTAR_PreviousAreas[7]=6;
NTAR_PreviousAreas[8]=2;
NTAR_PreviousAreas[9]=3;
NTAR_PreviousAreas[10]=4;
NTAR_PreviousAreas[11]=6;
NTAR_PreviousAreas[12]=7;
NTAR_PreviousAreas[13]=9;
NTAR_PreviousAreas[14]=10;
NTAR_PreviousAreas[15]=11;
NTAR_PreviousAreas[16]=12;
NTAR_PreviousAreas[17]=3;
NTAR_PreviousAreas[18]=17;
NTAR_PreviousAreas[19]=17;
NTAR_PreviousAreas[20]=6;
NTAR_PreviousAreas[21]=20;
NTAR_PreviousAreas[22]=21;
NTAR_PreviousAreas[23]=22;
NTAR_PreviousAreas[24]=23;
NTAR_PreviousAreas[25]=24;
NTAR_PreviousAreas[26]=7;
NTAR_PreviousAreas[27]=26;
NTAR_PreviousAreas[28]=27;
NTAR_PreviousAreas[29]=28;
NTAR_PreviousAreas[30]=29;
NTAR_PreviousAreas[31]=30;
NTAR_PreviousAreas[32]=31;
NTAR_PreviousAreas[33]=32;
NTAR_PreviousAreas[34]=33;
NTAR_PreviousAreas[35]=34;
NTAR_PreviousAreas[36]=35;
NTAR_PreviousAreas[37]=36;
NTAR_PreviousAreas[38]=4;
NTAR_PreviousAreas[39]=1;
NTAR_PreviousAreas[40]=1;
NTAR_PreviousAreas[41]=40;
NTAR_PreviousAreas[42]=41;
NTAR_PreviousAreas[43]=42;
NTAR_PreviousAreas[44]=43;
NTAR_PreviousAreas[45]=44;
NTAR_PreviousAreas[46]=74;
NTAR_PreviousAreas[47]=40;
NTAR_PreviousAreas[48]=47;
NTAR_PreviousAreas[49]=48;
NTAR_PreviousAreas[50]=40;
NTAR_PreviousAreas[51]=50;
NTAR_PreviousAreas[52]=51;
NTAR_PreviousAreas[53]=52;
NTAR_PreviousAreas[54]=53;
NTAR_PreviousAreas[55]=41;
NTAR_PreviousAreas[56]=42;
NTAR_PreviousAreas[57]=56;
NTAR_PreviousAreas[58]=45;
NTAR_PreviousAreas[59]=55;
NTAR_PreviousAreas[60]=57;
NTAR_PreviousAreas[61]=58;
NTAR_PreviousAreas[62]=43;
NTAR_PreviousAreas[63]=62;
NTAR_PreviousAreas[64]=63;
NTAR_PreviousAreas[65]=44;
NTAR_PreviousAreas[66]=46;
NTAR_PreviousAreas[67]=46;
NTAR_PreviousAreas[68]=46;
NTAR_PreviousAreas[69]=46;
NTAR_PreviousAreas[70]=46;
NTAR_PreviousAreas[71]=46;
NTAR_PreviousAreas[72]=46;
NTAR_PreviousAreas[73]=1;
NTAR_PreviousAreas[74]=54;
NTAR_PreviousAreas[75]=1;
NTAR_PreviousAreas[76]=75;

NTAR_PreviousAreas[77]=76;
NTAR_PreviousAreas[78]=76;
NTAR_PreviousAreas[79]=78;
NTAR_PreviousAreas[80]=79;
NTAR_PreviousAreas[81]=80;
NTAR_PreviousAreas[82]=81;
NTAR_PreviousAreas[83]=82;
NTAR_PreviousAreas[84]=76;
NTAR_PreviousAreas[85]=76;
NTAR_PreviousAreas[86]=78;
NTAR_PreviousAreas[87]=86;
NTAR_PreviousAreas[88]=78;
NTAR_PreviousAreas[89]=88;
NTAR_PreviousAreas[90]=87;
NTAR_PreviousAreas[91]=89;
NTAR_PreviousAreas[92]=80;
NTAR_PreviousAreas[93]=92;
NTAR_PreviousAreas[94]=80;
NTAR_PreviousAreas[95]=80;
NTAR_PreviousAreas[96]=81;
NTAR_PreviousAreas[97]=81;
NTAR_PreviousAreas[98]=82;
NTAR_PreviousAreas[99]=82;
NTAR_PreviousAreas[100]=83;
NTAR_PreviousAreas[101]=100;
NTAR_PreviousAreas[102]=101;
NTAR_PreviousAreas[103]=102;
NTAR_PreviousAreas[104]=103;
NTAR_PreviousAreas[105]=104;
NTAR_PreviousAreas[106]=105;
NTAR_PreviousAreas[107]=106;
NTAR_PreviousAreas[108]=107;
NTAR_PreviousAreas[109]=103;
NTAR_PreviousAreas[110]=109;
NTAR_PreviousAreas[111]=110;
NTAR_PreviousAreas[112]=111;
NTAR_PreviousAreas[113]=112;
NTAR_PreviousAreas[114]=113;
NTAR_PreviousAreas[115]=113;
NTAR_PreviousAreas[116]=115;
NTAR_PreviousAreas[117]=115;
NTAR_PreviousAreas[118]=117;
NTAR_PreviousAreas[119]=118;
NTAR_PreviousAreas[120]=118;
NTAR_PreviousAreas[121]=109;
NTAR_PreviousAreas[122]=121;
NTAR_PreviousAreas[123]=122;
NTAR_PreviousAreas[124]=123;
NTAR_PreviousAreas[125]=0;
NTAR_PreviousAreas[126]=112;
NTAR_PreviousAreas[127]=117;
NTAR_PreviousAreas[128]=120;
NTAR_PreviousAreas[129]=128;
NTAR_PreviousAreas[130]=129;
NTAR_PreviousAreas[131]=130;
NTAR_PreviousAreas[132]=131;


NTAR_PreviousAreas[133]=109;
NTAR_PreviousAreas[134]=109;
NTAR_PreviousAreas[135]=109;
NTAR_PreviousAreas[136]=109;

var NTAR_NextArea = new Array(133);
NTAR_NextArea[1]=2;
NTAR_NextArea[2]=3;
NTAR_NextArea[3]=4;
NTAR_NextArea[4]=10;
NTAR_NextArea[10]=5;
NTAR_NextArea[5]=6;
NTAR_NextArea[6]=7;
NTAR_NextArea[7]=26;
NTAR_NextArea[26]=27;
NTAR_NextArea[27]=28;
NTAR_NextArea[28]=29;
NTAR_NextArea[29]=30;
NTAR_NextArea[30]=31;
NTAR_NextArea[31]=32;
NTAR_NextArea[32]=33;
NTAR_NextArea[33]=34;
NTAR_NextArea[34]=35;
NTAR_NextArea[35]=36;
NTAR_NextArea[36]=37;
NTAR_NextArea[37]=40;
NTAR_NextArea[76]=78;
NTAR_NextArea[115]=117;
NTAR_NextArea[113]=115;
NTAR_NextArea[118]=120;


function NTAR_GetUserArea(username)
{
	// Validate arguments
	if(arguments.length == 0)
		return false;
	if(!username.isString)
	{
		// NTC_DebugPrint('');
		print(arguments.callee.name + ' error, username not a string : '+ username.toSource());
		return false;
	}
	
	//	Check if username is my name
	if(username == me.charname)
		return me.area;
		
	//	Check if user is nearby
	var playerUnit = getUnit(0, username);
	if(playerUnit)
		return playerUnit.area;
	
	//	Did not find user nearby, search in party
	//	NOTE:	This will return 0 for matching players
	//			that aren't partied, even if they are in game
	playerUnit = getParty().getUser(username);
	// if(!areaid)
		// NTC_DebugPrint('');
	if(!playerUnit)
		return false;
		
	return playerUnit.area;
}	

